//
//  SplashViewController.swift
//  Runner
//
//  Created by dev on 2021/4/6.
//

import Foundation
import UIKit
import Lottie

public class SplashViewController: UIViewController {
    
    private var animationView: AnimationView?
    
    public override func viewDidLoad() {
        let h = UIScreen.main.bounds.width / 1500 * 3248
        let y = (UIScreen.main.bounds.height - h) / 2
        animationView = .init(name: "splash_screen")
        animationView!.frame = CGRect(x: 0, y: y, width: UIScreen.main.bounds.width, height: h)
        // animationView!.contentMode = .scaleAspectFit
        animationView!.loopMode = .playOnce
        animationView!.animationSpeed = 1.00
        view.addSubview(animationView!)
    }
    
    public override func viewDidAppear(_ animated: Bool) {
        animationView!.play{ (finished) in
            print("所以我要跳广告去了")
            self.startFlutterApp()
        }
    }
    
    func startFlutterApp() {
        self.navigationController?.pushViewController(flutterViewController!, animated: true)
    }
}

